package com.fenghuajueli.lib_data.database;

import android.content.Context;

import com.fenghuajueli.lib_data.database.manager.ActionDaoManager;
import com.fenghuajueli.lib_data.database.manager.DraftsLocalManager;
import com.fenghuajueli.lib_data.database.manager.DraftsManager;
import com.fenghuajueli.lib_data.database.manager.KaDianCollectionManager;
import com.fenghuajueli.lib_data.entity.db.VideoInfoEntity;

public class DaoUtils {

    private static DraftsLocalManager draftsLocalManager;
    private static DraftsManager draftsManager;
    private static KaDianCollectionManager kaDianCollectionManager;
    private static ActionDaoManager<VideoInfoEntity,String> videoCollectionManager;

    public static Context context;

    public static void init(Context context) {
        DaoUtils.context = context;
    }

    /**
     * 单列模式获取草稿箱数据库访问对象
     *
     * @return
     */
    public static DraftsLocalManager getDraftsManager() {
        if (draftsLocalManager == null) {
            draftsLocalManager = new DraftsLocalManager(context);
        }
        return draftsLocalManager;
    }


    /**
     * 新的草稿箱数据管理
     *
     * @return
     */
    public static DraftsManager getLocalDraftsManager() {
        if (draftsManager == null) {
            draftsManager = new DraftsManager(context);
        }
        return draftsManager;
    }


    public static KaDianCollectionManager getKaDianCollectionManager() {
        if (kaDianCollectionManager == null) {
            kaDianCollectionManager = new KaDianCollectionManager(context);
        }
        return kaDianCollectionManager;
    }

    public static ActionDaoManager<VideoInfoEntity,String> getVideoCollectionManager() {
        if (videoCollectionManager == null) {
            videoCollectionManager = new ActionDaoManager<VideoInfoEntity,String>(context);
        }
        return videoCollectionManager;
    }
}
